#include"../logs/zllog.h"

void test_log(const std::string& name)
{
    INFO("%s","测试开始");
    zllog::Logger::ptr logger = zllog::LoggerManager::getInstance().getLogger(name);
    logger->info("%s","测试日志");
    logger->debug("%s","测试日志");
    logger->warn("%s","测试日志");
    logger->error("%s","测试日志");
    logger->fatal("%s","测试日志");
    INFO("%s","测试结束");


}

int main()
{
    zllog::LogBuilder::ptr builder = std::make_shared<zllog::GlobalLoggerBuilder>();
    builder->buildLoggerFormatter("[%d{%H:%M:%S}][%t][%c][%f:%l][%p]%T%m%n");
    builder->buildLoggerLevel(zllog::LogLevel::value::DEBUG);
    builder->buildLoggerName("async_logger");
    builder->buildLoggerType(zllog::LoggerType::LOGGER_ASYNC);
    builder->buildSink<zllog::StdoutSink>();
    builder->buildSink<zllog::FileSink>("./logfile/FileSink.log");
    builder->buildSink<zllog::RollBySizeSink>("./logfile/RollBySizeSink-",1024 * 1024);
    builder->buildSink<zllog::RollByTimeSink>("./logfile/RollByTimeSink-",zllog::TimeGap::GAP_SECOND);
    builder->build();

    test_log("async_logger");


    return 0;
}
